package com.suneast.suneaststore.modules.personal.address.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suneast.suneaststore.R;
import com.suneast.suneaststore.bean.personal.address.AreaBean;

public class AreaAdapter extends BaseQuickAdapter<AreaBean, AreaAdapter.VH> {
    private int curId = -1;

    public AreaAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(VH helper, AreaBean item) {
        TextView tv = helper.getView(R.id.tv_area);
        tv.setText(item.getAreaName());
        if (item.getId() == curId) {
            helper.getView(R.id.img_tick).setVisibility(View.VISIBLE);
            tv.setTextColor(helper.itemView.getResources().getColor(R.color.green_dark));
        } else {
            helper.getView(R.id.img_tick).setVisibility(View.GONE);
            tv.setTextColor(helper.itemView.getResources().getColor(R.color.black));
        }
    }

    static class VH extends BaseViewHolder {

        public VH(View view) {
            super(view);
        }
    }

    public int getCurId() {
        return curId;
    }

    public void setCurId(int curId) {
        this.curId = curId;
    }
}
